package br.ufrj.dcc.smarthotel;

import org.json.JSONObject;

import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;

/***
 * Activity que lista os pontos turisticos do menu tour da aplicacao
 * @author Diego Xavier
 * @author Patricia Zudio
 */
public class TourMenuActivity extends ListActivity {
	
	private JSONObject[] sightList;
	//private final String url = "http://www.dcc.ufrj.br/~diegoxavier/tour.php";
	
	/***
     * Metodo chamado na criacao da Activity
     * @param savedInstanceState - Parametros para a inicializacao da Activity
     */
    @Override
    public void onCreate(Bundle savedInstanceState) 
    {
    	//Chama o OnCreate da Classe Activity
        super.onCreate(savedInstanceState);
        this.sightList = Util.getInstance(this.getApplicationContext()).serverHttpGetList(Constants.TOUR_URL, null);
        this.setListAdapter(new ListAdapterImageTextMenu(this, sightList));
    }
    
    
    @Override
	protected void onListItemClick(ListView l, View v, int position, long id) {

		long itemId = this.getListAdapter().getItemId(position);
		
		Bundle params = new Bundle();
		params.putLong("itemId", itemId);

		Intent it = new Intent(this, SightDescriptionActivity.class);
		it.putExtras(params);
		startActivity(it);
	}
    
    
}
